< previous page page_226 next page >

Page 226
File Open/Save Dialog
The File Open dialog box is shown in Figure 11.7. The File Save As dialog box is essentially the same box, except the title reads Save As.
8160-0226a.gif
Figure 11.7
The File Open dialog box from the common dialog control.
This dialog box is generated by the following code:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdFileOpen_Click()
   Dim strFiles As String

   cdlCommon.InitDir = App.Path

   ' NOTE: Don't put spaces by the Pipe character!
   cdlCommon.Filter = "Access Databases (*.mdb)|*.mdb|" & _
                    "INI Files (*.ini)|*.ini|" & _
                    "All Files (*.*)|*.*"

   cdlCommon.Flags = cdlOFNAllowMultiselect + _
                    cdlOFNLongNames + _
                    cdlOFNExplorer
   cdlCommon.MaxFileSize = 3000

   cdlCommon.ShowOpen

   strFiles = cdlCommon.FileName
   txtFileOpen.Text = strFiles
End Sub
To use this sample you need to add the common dialog control from the Project, Components menu and set the Name property to ctlCommon.

 
< previous page page_226 next page >

If you like this book, buy it!